// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "WorldMath.h"

/**
 * Iterate through the points on the arc.
 * Reference: https://github.com/DLR-TS/sumo/blob/master/src/netimport/NIImporter_OpenDrive.cpp
 */
class FWorldArcIterator
{
public:

	FWorldArcIterator();
	FWorldArcIterator(double curvature, double length, double res);

	bool HasNext() const;
	void Next();
	void Reset(double curvature, double length, double res);

	glm::dvec3 Sample();
	// Get the derivative at current sample point
	glm::dvec3 SampleDrv();

	double S() const;

private:

	double _curvature;
	double _length;
	double _res;

	double _radius;
	glm::dvec2 _center;
	glm::dvec2 _point;
	double _sStart;
	double _sEnd;
	double _s;
	double _ds;
	bool _itEnd;
	
};
